package lab10.com.acme;

import java.io.Serializable;

public class Bank implements Serializable
{
	private final Client[] clients;
	private int maxClients = 0;
	private ClientRegistrationListener[] listeners;

	public Bank(final int bankSize,
			ClientRegistrationListener[] crls)
	{
		clients = new Client[bankSize];
		listeners = crls;
	}

	public Client addClient(final Client client)
	{
		clients[maxClients++] = client;
		
		for (ClientRegistrationListener crl : listeners)
		{
			crl.onClientAdded(client);
		}
		return client;
	}
	
	public int getBankSize()
	{
		return maxClients;
	}
}
